home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12579 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.ahc.ameritech.com!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Exception Overhead
  5. Date: Wed, 20 Mar 1996 12:27:29 -0500
  6. Organization: Datalytics, Inc
  7. Message-ID: <31504001.27D7@datalytics.com>
  8. References: <4ipc4c$nl5@news.nstn.ca>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. hfreeman wrote:
  16. > When my apps throw exceptions, it is in truly exceptional situations,
  17. > thus, I'm not overly concerned about performance when exceptions are
  18. > thrown, but could someone please speak to the performance hits taken when
  19. > exceptions are used but not thrown (ie. when try blocks are entered and
  20. > exited). If a try block is used in a loop, is there a serious performance
  21. > penalty.
  22. > Thanks.
  23.  
  24. The performance hit is implementation-dependent.  The compiler 
  25. has to track which objects to destruct when an exception is 
  26. thrown at any point within a function, so just enabling 
  27. exception support invokes this overhead.  A try block shouldn't 
  28. incur much overhead, but I don't think it can incur zero 
  29. overhead.  As a result, you should always minimize your 
  30. try/catch blocks--keeping them out of loops, for example.
  31.  
  32. -- 
  33. Robert Stewart        | My opinions are usually my own.
  34. Datalytics, Inc.    | stew@datalytics.com
  35.